package main
import (
	"fmt"
)
type student struct {
	firstName string
	lastName string
	grade string
	country string
}
func filter(s []student, f func(student) bool) []student {
	var r []student
	for _, v := range s{
		if f(v) == true {
			r = append(r, v)
		}
	}
	return r
}
func main() {
	s1 := student{firstName: "yang1", lastName: "hao1", grade: "A", country: "China1"}
	s2 := student{firstName: "yang2", lastName: "hao2", grade: "B", country: "China2"}
	s := []student{s1, s2}
	f := filter(s, func(s student) bool{
		if s.grade == "B" {
			return true
		}
		return false
	})
	fmt.Println(f)

}